package com.medical.client;

import com.medical.client.model.Context;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.image.Image;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import java.io.IOException;

public class HelloApplication extends Application {

    @Override
    public void start(Stage stage) throws IOException {

        FXMLLoader tabPaneLoader = new FXMLLoader(HelloApplication.class.getResource("tab-panel.fxml"));

        // Create main panel
        BorderPane mainPanel = new BorderPane();
        mainPanel.setCenter(tabPaneLoader.load());

        StackPane stackPane = new StackPane();
        stackPane.getChildren().add(mainPanel);

        Context.stackPanel.put("stackPane",stackPane);

        // Create scene and stage
        Scene scene = new Scene(stackPane,1200,600);
        stage.setTitle("职业健康信息档案");

        // Set the stage icon
        Image icon = new Image(getClass().getResource("img/pe.png").toExternalForm());
        stage.getIcons().add(icon);


        stage.setScene(scene);

        stage.show();

        Context.stages.put("mainStage",stage);
    }

    public static void main(String[] args) {
        launch();
    }
}